if __name__ == "__main__":
    import cv2
    # 加载数字模板
    temps = []
    for i in range(10):
        temps.append(cv2.imread(f'nums/{i}.png', cv2.IMREAD_GRAYSCALE))


    # 读取图片并转为灰度图
    gray = cv2.imread('123456789.jpg', cv2.IMREAD_GRAYSCALE)
    ret, thresh = cv2.threshold(gray, 0, 255, cv2.THRESH_BINARY_INV|cv2.THRESH_OTSU)
    contours = cv2.findContours(thresh, cv2.RETR_LIST, cv2.CHAIN_APPROX_SIMPLE)[0]